package com.example.zhu.mapper;

import com.example.zhu.entity.Activity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface ActivityMapper {

    @Select("select * from activity")
    List<Activity> selectAll();

    @Select("select * from activity where activity_id = #{id}")
    Activity getById(Integer id);

    @Update("update activity set activity_status=#{activityStatus},activity_name=#{activityName},activity_introduce = #{activityIntroduce},activity_start_time = #{activityStartTime},activity_end_time=#{activityEndTime},popping = #{popping},activity_img = #{activityImg},activity_url = #{activityUrl},popping_url=#{poppingUrl} where activity_id = #{activityId}")
    void update(Activity activity);

    @Select("select * from activity where activity_id = #{activityId}")
    Activity selectById(Integer activityId);
}
